package com.fadadianqi.logistics.admin.staff.dao.ibatis;

import com.fadadianqi.logistics.admin.staff.dao.GroupActionDAO;
import com.fadadianqi.logistics.admin.staff.model.GroupAction;
import com.fadadianqi.commons.GenericDAOSuport;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class GroupActionDAOImpl extends GenericDAOSuport<String, GroupAction>
        implements GroupActionDAO {

    @Override
    public GroupAction getWithGroupIdAndActionId(String groupId, String actionId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("groupId", groupId);
        map.put("actionId", actionId);
        return super.getByPropertys(map);
    }

    @Override
    public List<GroupAction> findByGroupId(String groupId) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("groupId", groupId);
        return super.findByPropertys(map);
    }

    @Override
    protected Class<?> getObjectClass() {
        return GroupAction.class;
    }

    @Override
    protected String getTableName() {
        return "group_action";
    }

    @Override
    public void delByGroupId(String groupId) {
        super.removeByProperty("groupId", groupId);
    }

}
